window.addEventListener('load', function () {
    let tel = document.querySelector('#tel');
    let tel_img = document.querySelector('.tel_img');
    let tel_text = document.querySelector('.tel_text');
    tel.addEventListener('blur', function () {
        if (tel.value.length < 9 || tel.value.length > 11) {
            tel_text.innerHTML = '您输入的手机号码位数不对要求9~11位';
            tel_img.src = 'upload/wrong.png';
        }
        else {
            tel_text.innerHTML = '您输入的手机号码正确';
            tel_img.src = 'upload/right.png';
        }
    })
    //手机号码
    let text_btn = document.querySelector('.inp_btn');
    text_btn.addEventListener('click', function () {
        let i = 31;
        function declient() {
            i--;
            text_btn.innerHTML = '还剩' + i + '秒';
            text_btn.disabled = true;
            if (i == 0) {
                clearInterval(timer);
                text_btn.disabled = false;
                text_btn.innerHTML = '获取验证码';
            }
        }
        declient();
        let timer = setInterval(declient, 1000);
        console.log(text_btn);
    })
    //验证码计时器



    let form_password = document.querySelector('.form_password');
    let form_password_text = document.querySelector('.form_password_text');
    let form_password_img = document.querySelector('.form_password_img');
    form_password.addEventListener('blur', function () {
        if (form_password.value.length < 6 || form_password.value.length > 18) {
            form_password_text.innerHTML = '您输入的密码位数不对要求6~18位';
            form_password_img.src = 'upload/wrong.png';
        }
        else {
            form_password_text.innerHTML = '您输入的密码正确';
            form_password_img.src = 'upload/right.png';
        }
    })
    //密码验证
    let ruo = document.querySelector('.ruo');
    let zhong = document.querySelector('.zhong');
    let qiang = document.querySelector('.qiang');
    form_password.addEventListener('keyup', function () {
        if (form_password.value.length >= 6 && form_password.value.length < 10) {
            ruo.style.display = 'inline-block';
            zhong.style.display = 'none';
            qiang.style.display = 'none';
        }
        if (form_password.value.length >= 10 && form_password.value.length < 14) {
            zhong.style.display = 'inline-block';
            ruo.style.display = 'none';
            qiang.style.display = 'none';
        }
        if (form_password.value.length >= 14 && form_password.value.length < 18) {
            qiang.style.display = 'inline-block';
            ruo.style.display = 'none';
            zhong.style.display = 'none';
        }
    })
    //密码强度验证
    let form_true = document.querySelector('.form_true');
    let form_true_text = document.querySelector('.form_true_text');
    let form_true_img = document.querySelector('.form_true_img');
    form_true.addEventListener('blur', function () {
        if (form_true.value.length < 6 || form_true.length > 18) {
            form_true_text.innerHTML = '您输入的密码位数不对要求6~18位';
            form_true_img.src = 'upload/wrong.png';

        }
        else {

            form_true.addEventListener('keyup', function () {
                if (form_true.value == form_password.value) {
                    form_true_text.innerHTML = '两次输入的密码正确';
                    form_true_img.src = 'upload/right.png';
                }
                else {
                    form_true_text.innerHTML.innerHTML = '两次输入的密码不一致！';
                    form_true_img.src = 'upload/wrong.png';
                }
            })
        }

    })
    //密码两次是否一样验证

})